<!doctype html>
<!--
@license
Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<html>
<head>
  <meta charset="utf-8">
  <script>
    WCT = {
      mochaOptions: {
        timeout: 60000
      }
    }
  </script>
  <script src="unit/wct-browser-config.js"></script>
  <script src="../node_modules/wct-browser-legacy/browser.js"></script>
</head>
<body>
  <script>
    'use strict';

    let suites = [
      'unit/globals.html',
      'unit/property-accessors.html',
      'unit/template-stamp.html',
      'unit/strict-template-policy.html',
      'unit/property-effects.html',
      'unit/property-effects.html?legacyUndefined=true',
      'unit/property-effects.html?orderedComputed=true',
      'unit/property-effects-template.html',
      'unit/path-effects.html',
      'unit/path-effects.html?orderedComputed=true',
      'unit/shady.html',
      'unit/shady-events.html',
      'unit/shady-content.html',
      'unit/shady-dynamic.html',
      'unit/shady-dynamic.html?syncInitialRender=true',
      'unit/styling-scoped.html',
      'unit/styling-cross-scope-var.html',
      'unit/styling-cross-scope-apply.html',
      'unit/styling-cross-scope-unknown-host.html',
      'unit/styling-only-with-template.html',
      'unit/styling-build-adopted-stylesheets.html',
      'unit/custom-style.html',
      'unit/custom-style-late.html',
      'unit/custom-style-async.html',
      'unit/custom-style-scope-cache.html',
      'unit/events.html',
      'unit/template-whitespace.html',
      'unit/resolveurl.html',
      'unit/case-map.html',
      'unit/configure.html',
      'unit/ready-attached-order.html',
      'unit/ready-attached-order-class.html',
      'unit/attributes.html',
      'unit/async.html',
      'unit/behaviors.html',
      'unit/behaviors.html?legacyOptimizations=true',
      'unit/polymer.element.html',
      'unit/polymer.properties-mixin.html',
      'unit/polymer.properties-mixin-with-property-accessors.html',
      'unit/polymer.legacyelement.html',
      'unit/debounce.html',
      'unit/inheritance.html',
      'unit/path.html',
      'unit/templatize.html',
      'unit/dom-repeat.html',
      'unit/dom-repeat.html?removeNestedTemplates=true',
      'unit/dom-if.html',
      'unit/dom-if.html?removeNestedTemplates=true',
      'unit/dom-if.html?fastDomIf=true',
      'unit/dom-if.html?removeNestedTemplates=true&fastDomIf=true',
      'unit/dom-bind.html',
      'unit/array-selector.html',
      'unit/polymer-dom.html',
      // Forced to `noPatch` here to workaround
      // https://github.com/webcomponents/polyfills/issues/250.
      'unit/polymer-dom-nopatch.html?wc-noPatch=true',
      'unit/polymer-dom-observeNodes.html',
      'unit/flattened-nodes-observer.html',
      // TODO: substitute for equivalent es6 import tests
      // 'unit/importHref.html',
      // 'unit/dynamic-import.html',
      'unit/gestures.html',
      'unit/logging.html',
      'unit/mixin-utils.html',
      'unit/mixin-behaviors.html',
      'unit/render-status.html',
      'unit/dir.html',
      'unit/disable-upgrade.html',
      'unit/shady-unscoped-style.html',
      'unit/html-tag.html',
      'unit/legacy-data.html',
      'unit/legacy-undefined.html',
      'unit/legacy-noattributes.html',
      // 'unit/multi-style.html'
      'unit/class-properties.html',
      'unit/styling-scoped-nopatch.html'
    ];

    function combinations(suites, flags) {
      return flags.map((f) => {
        return f ? suites.map(s => `${s}${s.match(/\?/) ? '&' : '?'}${f}`) : suites;
      }).reduce((arr, s) => arr.concat(s), []);
    }

    function addUrlOption(previous = '', next = '') {
      return previous + (previous ? '&' : '') + next;
    }

    // test shadowdom/custom elements polyfills together
    // preferring both if possible.
    let flags = [''];
    if (window.customElements) {
      // NOTE: disabled because Native ShadowDOM and Polyfilled CustomElements is not an expected use-case.
      // flags.push('wc-ce=true');
    }
    // if native is available, make sure to test polyfill
    if (Element.prototype.attachShadow && Node.prototype.getRootNode) {
      flags.push('wc-shadydom=true');
    }
    // Both sd and ce are supported, force both polyfills
    if (flags.length === 2) {
      // ce + sd becomes a single test iteration.
      flags.push('wc-ce=true&wc-shadydom=true');
    }

    // economize testing by testing css shimming
    // only against 1 environment (native or polyfill).
    if (window.CSS && CSS.supports && CSS.supports('box-shadow', '0 0 0 var(--foo)')) {
      // Note: Disabled to speed up testing, may be reenabled at a later date when the test timing is less of an issue.
      // let last = flags.length === 1 ? '' : flags[flags.length - 1];
      // flags.push(addUrlOption(last, 'wc-shimcssproperties=true'));
    }
    suites = combinations(suites, flags);
    console.log('Testing suites:\n\t' + suites.join('\n\t'));

    WCT.loadSuites(suites);
  </script>
</body>
</html>
